//
//  AdvancedCollectionViewCell.m
//  Shine
//
//  Created by 俞青武 on 16/3/11.
//  Copyright © 2016年 王斌. All rights reserved.
//

#import "AdvancedCollectionViewCell.h"
#import "MASViewConstraint.h"


@implementation AdvancedCollectionViewCell

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView
{
    self.backgroundColor = COLORBLACK;
    self.button = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.button setBackgroundImage:[UIImage imageNamed:@"top_horiz@3x"]forState:UIControlStateNormal];
    [self.button addTarget:self action:@selector(buttonAct:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.button];
    
    self.label = [[UILabel alloc]init];
    self.label.textColor = COLORYELLO;
    self.label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.label];
    
    
    self.label2 = [[UILabel alloc]init];
    self.label2.textColor = COLORYELLO;
    self.label2.textAlignment = NSTextAlignmentCenter;
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:@"显示高级视图"];
    [str addAttribute:NSForegroundColorAttributeName value:COLORYELLO range:NSMakeRange(0, 2)];
    [str addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(2, 4)];
    [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:25] range:NSMakeRange(2, 4)];
    
    self.label2.attributedText = str;
    
    [self addSubview:self.label2];
    
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView).with.offset(0);
        make.centerY.equalTo(self.contentView).with.offset(-100);
        make.size.mas_equalTo(CGSizeMake(200,150));
    }];
    
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.button).with.offset(100);
        make.centerX.equalTo(self.button).with.offset(0);
        make.size.mas_equalTo(CGSizeMake(200, 100));
    }];
    
    [self.label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.label).with.offset(30);
        make.centerX.equalTo(self.label).with.offset(0);
        make.size.mas_equalTo(CGSizeMake(150, 100));
    }];
    
    
    
    
}

- (void)buttonAct:(UIButton *)button
{
    UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"标题" message:@"该功能尚在开发中尽请期待" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"好的", nil];
    [alertview show];
    
}



@end










